﻿@model IEnumerable<DuLichDLL.Model.DL_City>

@{
    ViewBag.Title = "CityManager";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<div style="text-align:center">
<h2 style="border-bottom: 2px solid #ff6a00">@Resources.Language.ListCity</h2>
</div>
@*<p>
    @Html.ActionLink("Create New", "Create")
</p>*@
<form id="frmMain" method="post" action="#">
    <input type="text" name="city_search" class="input-medium search-query" placeholder="Tên Thành Phố...">
    <button type="submit" class="btn" >@Resources.Language.Search</button>
    @if (null != Model)
    {
        var pageSize = int.Parse(ViewData[WebDuLichDev.Enum.PageInfo.PageSize.ToString()].ToString());
        var pageNum = int.Parse(ViewData[WebDuLichDev.Enum.PageInfo.PageNum.ToString()].ToString());
        var page = int.Parse(ViewData[WebDuLichDev.Enum.PageInfo.Page.ToString()].ToString());

        <input type="hidden" value="@ViewData["OrderBy"]" name="orderBy" id="orderBy" />
        <input type="hidden" value="@ViewData["OrderDirection"]" name="orderDirection"id="orderDirection" />
        <div class="container-fluid">
        <table class="table table-striped table-bordered table-condensed">
            <tr>
                <th >#</th>
                <th >
                    @Resources.Language.CountryCode
                </th>
                <th >
                    @Resources.Language.CityName
                </th>
                <th >
                    @Resources.Language.Avatar
                </th>
                <th> >>@Resources.Language.Control>>
                </th>
            </tr>
            @{int i = 0;}
            @foreach (var item in Model)
            {
                <tr>
                    <td >
                         @((page - 1) * pageSize + i + 1)

                    </td>
                    <td >
                        @Html.DisplayFor(modelItem => item.CountryCode)
                    </td>
                    <td >
                        @Html.DisplayFor(modelItem => item.CityName)
                    </td>
                    <td >
                        <img src="../../Data/Avatar/City/@Html.DisplayFor(modelItem => item.Avatar)" alt="Image City..." class="img-polaroid" width="90" height="80" />
                    </td>
                    <td >
                        <input class="btn btn-primary btn-large" id="btnEdit" type="button" value="@Resources.Language.Edit>>" onclick="location.href='@Url.Action("AddCity", "City", new { id = item.ID })    ' " />
                    </td>
                </tr>
                i++;
            }

        </table>
            </div>
        
        <table>
            <tr>
                @Html.Partial("p_Pagination", null, ViewData)
            </tr>
        </table>
    }
</form>
